{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block content %}
    <h1>{% trans "Delete event" %}</h1>
    {% if request.event.allow_delete %}
        {% bootstrap_form_errors form layout="inline" %}
        <p>
            {% blocktrans trimmed %}
                This operation will destroy your event including all configuration, products, quotas, questions,
                vouchers, lists, etc.
            {% endblocktrans %}
        </p>
        <p><strong>
            {% blocktrans trimmed %}
                This operation is irreversible and there is no way to bring your data back.
            {% endblocktrans %}
        </strong></p>
        <form action="" method="post">
            {% csrf_token %}
            <p>
                {% blocktrans trimmed with slug=request.event.slug %}
                    To confirm you really want this, please type out the event's short name ("{{ slug }}") here:
                {% endblocktrans %}
            </p>
            {% bootstrap_field form.slug layout="inline" %}

            <div class="form-group submit-group">
                <button type="submit" class="btn btn-delete btn-danger btn-save">
                    {% trans "Delete" %}
                </button>
            </div>
        </form>
    {% else %}
        <p>
            {% trans "Your event can not be deleted as it already contains orders." %}
        </p>
        <p>
            {% blocktrans trimmed %}
            To ensure audit compliance and maintain trust with financial authorities, deleting orders once they have been placed is not permitted.
            {% endblocktrans %}
        </p>
        {% if request.event.live %}
            <p>
                {% trans "You can instead take your shop offline. This will hide it from everyone except from the organizer teams you configured to have access to the event." %}
            </p>
            <form action="{% url "control:event.live" event=request.event.slug organizer=request.organizer.slug %}"
                    method="post">
                {% csrf_token %}
                <input type="hidden" name="live" value="false">

                <div class="form-group submit-group">
                    <a href="{% url "control:event.shredder.start" event=request.event.slug organizer=request.organizer.slug %}" class="btn btn-delete btn-danger btn-save">
                        <span class="fa fa-eraser"></span>
                        {% trans "Delete personal data" %}
                    </a>
                    <button type="submit" class="btn btn-primary btn-save">
                        <span class="fa fa-power-off"></span>
                        {% trans "Go offline" %}
                    </button>
                </div>
            </form>
        {% else %}
            <p>
                {% trans "However, since your shop is offline, it is only visible to the organizing team according to the permissions you configured." %}
                <div class="form-group submit-group">
                    <a href="{% url "control:event.shredder.start" event=request.event.slug organizer=request.organizer.slug %}" class="btn btn-delete btn-danger btn-save">
                        <span class="fa fa-eraser"></span>
                        {% trans "Delete personal data" %}
                    </a>
                </div>
            </p>
        {% endif %}
    {% endif %}
{% endblock %}
